package abacab.ref;

import abacab.ActorSystem;
import abacab.ActorSystemImpl;

/**
 * A reference to an actor or group of actors
 * 
 * @param <M>
 *          the type of messages handled by the actor(s)
 */
public abstract class AbstractActorRef<M> implements ActorRef<M> {
	/** The reference's name */
	private final String					reference;

	/** The actor system it belongs to */
	private final ActorSystemImpl	system;

	/**
	 * Create an instance
	 * 
	 * @param reference
	 *          the reference's name
	 * @param system
	 *          the actor system it belongs to
	 */
	public AbstractActorRef(String reference, ActorSystemImpl system) {
		this.reference = reference;
		this.system = system;
	}

	/**
	 * @return the actor system
	 */
	public ActorSystem getSystem() {
		return this.system;
	}

	@Override
	public final String getPath() {
		return this.system.getPath() + "/" + this.reference;
	}

	/**
	 * Stop the actor
	 */
	@Override
	public void stop() {
		// Defaults to nothing
	}
}